import {createRouter,createWebHashHistory} from 'vue-router'
// 1. 定义路由组件.
// 也可以从其他文件导入
 import Login from '../components/Login.vue'
 import pclogin from '../components/pclogin.vue'
 import Main from '../components/Main.vue'
 import Main1 from '../components/Main1.vue'
 import usercontrol from '../views/usercontrol.vue'
 import zixunshicontrol from '../views/zixunshicontrol.vue'
 import yuyuecontrol from '../views/yuyuecontrol.vue'
 import pagecontrol from '../views/pagecontrol.vue'
 import webdate from '../views/webdate.vue'
 import testcontrol from '../views/testcontrol.vue'
 import wendacontrol from '../views/wendacontrol.vue'
 import wenticlass from '../views/wenticlass.vue'
 import articlescontrol from '../views/articlescontrol.vue'
 import pcinfo from '../views/pcinfo.vue'
 import pcyuyue from '../views/pcyuyue.vue'
 import testcontrol2 from '../views/testcontrol2.vue'
 import testcontrol3 from '../views/testcontrol3.vue'
 import workschedule from '../views/workschedule.vue'
 import testcheck from '../views/testcheck.vue'
// 2. 定义一些路由
// 每个路由都需要映射到一个组件。
// 我们后面再讨论嵌套路由。
const routes = [
  { path: '/', name:"登录",component: Login },  //name不能重复\
  { path: '/pclogin', name:"咨询师登录",component: pclogin }, 
  { path: '/main', name:"主界面",component: Main,children:[
    { path: '/usercontrol',name:"用户管理",meta:{power: 0}, component: usercontrol },
    { path: '/zixunshicontrol',name:"咨询师管理", meta:{power:0},component: zixunshicontrol },
    { path: '/yuyuecontrol',name:"预约管理", meta:{power: 0},component: yuyuecontrol },
    { path: '/pagecontrol', name:"文章管理",meta:{power:0},component: pagecontrol },
    { path: '/articlescontrol', name:"文章分类",meta:{power:0},component: articlescontrol },
    { path: '/webdate', name:"网站数据",meta:{power:0},component: webdate },
    { path: '/testcontrol', name:"问卷题库一",meta:{power:0},component: testcontrol },
    { path: '/wenticlass', name:"问题分类",meta:{power:0},component: wenticlass },
    { path: '/wendacontrol', name:"问答管理",meta:{power:0},component: wendacontrol },
    { path: '/testcontrol2', name:"问卷题库二",meta:{power:0},component: testcontrol2 },
    { path: '/testcontrol3', name:"问卷题库三",meta:{power:0},component: testcontrol3 },
    { path: '/testcheck', name:"问卷测评",meta:{power:0},component: testcheck },
  ] },
  { path: '/main1', name:"咨询师界面",component: Main1,children:[
    { path: '/pcinfo', name:"咨询师信息管理",meta:{power:2},component: pcinfo },
    { path: '/pcyuyue', name:"咨询师预约信息管理",meta:{power:2},component: pcyuyue },
    { path: '/workschedule', name:"咨询师个人排班信息",meta:{power:2},component: workschedule },
  ] },
]

// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes, // `routes: routes` 的缩写
})


export default router
// 现在，应用已经启动了！